1. Field of the Invention
The present invention relates to an in-circuit emulator used in a microprocessor incorporating a memory management unit (MMU).
2. Description of the Related Art Including Information Disclosed Under .sctn. 1.97-1.99.
In computer technology, to execute a large program using a small-capacity memory without lowering the program operation speed, and to improve the use efficiency of the memory, the virtual storage technique is employed. When a CPU executes a program, addresses in the main memory are not accessed by the CPU at random; only specific addresses are accessed when considered within a certain period during execution of the program. The virtual storage technique utilizes this fact. In this technique, the entire program to be executed is stored in a submemory such as a hard disk and only the necessary part is loaded in the main memory, thereby executing the program. Accordingly, a large program can be executed using a small-capacity memory or simultaneous execution (multitasking) of a plurality of programs can be efficiently performed.
More specifically, a program is divided into a plurality of blocks each having a predetermined size. During execution of a program consisting of a plurality of blocks, currently-required blocks are loaded in the main memory and unnecessary blocks are left in the sub-memory. When a block that is not loaded in the main memory is to be executed as the execution of the program progresses, the CPU temporarily interrupts the execution of the program and transfers control to an OS (operating system). In this case, the OS searches for a block in the main memory that has not been repeatedly accessed, e.g. the least-recently used block. The OS then re-stores this unnecessary block in the sub-memory or discards it, thereby leaving a free area created in the main memory. Subsequently, the OS transfers and loads the block to be executed from the sub-memory into the free area created in the main memory and restarts the execution of the interrupted program. As described above, in practice, a program is executed using a small-capacity main memory, but the system operates as if an entire program were stored in a virtual large-capacity main memory. Therefore, storage in this virtual main memory is termed virtual storage.
To realize this virtual storage technique, a circuit is required to translate an address (a virtual address) in a virtual memory into an address (physical address) in a main memory at which part of a corresponding program is stored. This circuit is called a memory management unit (MMU). The MMU refers to a translation table that stores physical addresses determined by the OS when the OS loads desired blocks of a program in a main memory, and translates a virtual address into a physical address. The MMU includes a TLB (Translation Look-aside Buffer) for storing several pieces of translated information. The contents of the TLB are constantly updated by information translated by referring to the translation table. The MMU does not always refer to the translation table to perform translation. When translation can be performed by referring to the TLB, translation is performed directly. The translation table is referred only when translation information is not present in the TLB, thereby decreasing the number of accesses to the memory.
More specifically, the virtual address is the one prior to translation by the MMU, and the physical address is the one after translation. A normal program is designed to be operated by this virtual address.
A conventional MMU of this type has previously been produced as an LSI which is independent of a microprocessor chip. Recently, however, a VLSI microprocessor chip, such as the 80386 available from Intel Corporation and the V60 available from NEC Corporation, has been produced which incorporates an MMU to increase the speed of translation from a virtual address into a physical address. Therefore, in a microprocessor chip incorporating the memory MMU, a virtual address is translated into a physical address in the microprocessor chip, and only the physical address is output from the microprocessor chip.
An in-circuit emulator is a kind of development tool for software and hardware that is used for efficiently developing a system (to be referred to as a target system hereinafter) to which a microprocessor is applied. It is used especially for debugging programs contained in a target system.
A target system is constituted by a microprocessor, a memory for storing programs and data, and an I/O port for controlling the system. The microprocessor of a target system under development is not directly fixed to the system, but is detachably mounted using a socket on a printed circuit board or something similar.
When a program contained in a target system is to be debugged using an in-circuit emulator, the microprocessor of the target system is unplugged from the target system socket, and the plug of the in-circuit emulator is connected to the socket instead. A microprocessor equivalent to the one mounted on the target system is incorporated in the in-circuit emulator and is used to debug the program. Debugging is performed by the microprocessor incorporated in the in-circuit emulator. Thus, this microprocessor is called an emulation microprocessor or an emulation processor. That is, the emulation processor executes the program of the target system in place of the microprocessor to be incorporated in the target system. In addition, an in-circuit emulator has a break function for breaking execution of the program at an arbitrary point designated by a user so as to allow debugging of the program, a start continue function for restarting the execution, a trace function for storing and displaying an execution process of the program, a function for referring or modifying the contents of a memory and register, an emulation memory for emulating the memory function of the target system, and the like. The user debugs the program of the target system using these functions.
The most important function in an in-circuit emulator is the break function. Bugs in the program cause erroneous operation of the target system. It is difficult for the user to find a bug in the program when an erroneous operation actually occurs. The user notices an unexpected output in the final result and realizes that a bug is present somewhere in the program. In this case, when debugging is to be performed, execution of the program is interrupted at an arbitrary point, and the contents of a register or memory are repeatedly checked until the bug is found. In general, therefore, the break function uses an address to designate a break location in the program or data, thereby breaking the execution when the CPU accesses the designated address.
FIG. 1 is a block diagram of a conventional in-circuit emulator. The conventional in-circuit emulator is described in detail below with reference to FIG. 1.
Emulation processor 7 is a microprocessor to be used in target system 5. Control signal J, data b, and physical address d are supplied from emulation processor 7 to CPU socket 4 of target system 5, to which a microprocessor of system 5 ought to be connected, through bus g. Break detection circuit 6 receives physical address d from emulation processor 7 and outputs break request signal f. Break request signal f is supplied to emulation processor 7.
In an in-circuit emulator arranged in this manner, a program is executed such that emulation processor 7 accesses target system 5, to which emulation processor 7 is connected through buffer circuit 3 and CPU socket 4. When physical address d, which is constantly monitored by break detection circuit 6, becomes a predetermined value during execution of the program, break request signal f is output and causes emulation processor 7 to stop the execution.
However, the following problems are posed in such an in-circuit emulator.
(1) It does not allow debugging of a program which is designed for a microprocessor incorporating an MMU by utilizing virtual addresses. This is because an address output from the emulation processor is a physical address after translation by the MMU incorporated in the emulation processor. Therefore, a breakpoint cannot be set by a virtual address.
(2) When an error occurs during execution of the program because of a malfunction of the emulation processor, it is difficult to immediately determine whether the error has been caused by an erroneous operation of the emulation processor or by a bug in the program.